package com.example.studyproject.enums;

import cn.hutool.core.util.StrUtil;

/**
 * @program: StudyProject
 * @description: 免登录白名单接口枚举
 * @author: kangwei
 * @create: 2024-08-14 09:55
 **/

public enum NotLoginWhiteListInterfaceEnum {
    QR("qr", "二维码"),
    TEST("test", "测试"),
    PRODUCT("product", "产品"),
    ;

    private String code;
    private String msg;

    NotLoginWhiteListInterfaceEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public static boolean isNotLogin(String url) {
        for (NotLoginWhiteListInterfaceEnum value : values()) {
            if (StrUtil.isNotBlank(url) && url.contains(value.getCode())) {
                return true;
            }
        }
        return false;
    }
}
